<template>
	<view class="">
		<scroll-view  scroll-y="true" class="scroll-Y" @scrolltolower="loadMore" style="height: 98vh;">
		<view class="jui_mar_2432 jui_bg_fff jui_pad_2432 jui_bor_rad_30" v-for="(item,index) in list" :key="index" @tap="detail(item)">
			<view class="">
				{{item.title}}
			</view>
			<view class="jui_fc_999 jui_fs28 jui_mar_t20 jui_mar_b8">
				{{item.create_time}}
			</view>
			<view class="jui_ellipsis_2">
				{{item.content}}
			</view>
		</view>
		
		<shopro-empty v-if="!list.length" :emptyData="emptyData"></shopro-empty>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		
		data(){
			return{
				emptyData: {
					img: '/static/imgs/home/empty_goods.png',
					tip: '暂无数据~'
				},
				page:1,
				size:15,
				hasMore:false,
				list:[]
			}
		},
		onLoad() {
			// this.news()
		},
		methods:{
			detail(item){
				uni.navigateTo({
					url:`/pages/index/news/newsDetail?id=${item.id}`
				})
			},
			news(){
				let data = {
					page: this.page,
					size: this.size
				}
				this.$api.getMessage(data).then(res => {
					this.list = [...this.list, ...res.data.data]
					if (res.data.data.length == 0) {
						this.hasMore = false
					} else {
						this.hasMore = true
					}
				});
			},
			loadMore(){
				console.log(123)
				if(this.hasMore){
					this.page ++ ;
					this.news();
				}
			},
		}
	}
</script>

<style>
</style>
